package com.ruoyi.safe.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.safe.mapper.RiskUnitMapper;
import com.ruoyi.safe.domain.RiskUnit;
import com.ruoyi.safe.service.IRiskUnitService;

/**
 * 风险单元Service业务层处理
 * 
 * @author yxf
 * @date 2021-08-10
 */
@Service
public class RiskUnitServiceImpl implements IRiskUnitService 
{
    @Autowired
    private RiskUnitMapper riskUnitMapper;

    /**
     * 查询风险单元
     * 
     * @param ruId 风险单元ID
     * @return 风险单元
     */
    @Override
    public RiskUnit selectRiskUnitById(Long ruId)
    {
        return riskUnitMapper.selectRiskUnitById(ruId);
    }

    /**
     * 查询风险单元列表
     * 
     * @param riskUnit 风险单元
     * @return 风险单元
     */
    @Override
    public List<RiskUnit> selectRiskUnitList(RiskUnit riskUnit)
    {
        return riskUnitMapper.selectRiskUnitList(riskUnit);
    }

    /**
     * 新增风险单元
     * 
     * @param riskUnit 风险单元
     * @return 结果
     */
    @Override
    public int insertRiskUnit(RiskUnit riskUnit)
    {
        riskUnit.setCreateTime(DateUtils.getNowDate());
        return riskUnitMapper.insertRiskUnit(riskUnit);
    }

    /**
     * 修改风险单元
     * 
     * @param riskUnit 风险单元
     * @return 结果
     */
    @Override
    public int updateRiskUnit(RiskUnit riskUnit)
    {
        riskUnit.setUpdateTime(DateUtils.getNowDate());
        return riskUnitMapper.updateRiskUnit(riskUnit);
    }

    /**
     * 批量删除风险单元
     * 
     * @param ruIds 需要删除的风险单元ID
     * @return 结果
     */
    @Override
    public int deleteRiskUnitByIds(Long[] ruIds)
    {
        return riskUnitMapper.deleteRiskUnitByIds(ruIds);
    }

    /**
     * 删除风险单元信息
     * 
     * @param ruId 风险单元ID
     * @return 结果
     */
    @Override
    public int deleteRiskUnitById(Long ruId)
    {
        return riskUnitMapper.deleteRiskUnitById(ruId);
    }
}
